package com.cskaoyan.mall.promo.converter;

import com.cskaoyan.mall.dto.ProductDetailDto;
import com.cskaoyan.mall.promo.dal.entitys.PromoItem;
import com.cskaoyan.mall.promo.dto.PromoProductDetailDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.springframework.beans.BeanUtils;
@Mapper(componentModel = "spring")
public interface PromoProductConverter {

    @Mappings(
            {
                    @Mapping(source = "productDetailDto.productId", target = "productId"),
                    @Mapping(source = "productDetailDto.salePrice", target = "salePrice"),
                    @Mapping(source = "productDetailDto.productName", target = "productName"),
                    @Mapping(source = "productDetailDto.subTitle", target = "subTitle"),
                    @Mapping(source = "productDetailDto.limitNum", target = "limitNum"),
                    @Mapping(source = "productDetailDto.productImageBig", target = "productImageBig"),
                    @Mapping(source = "productDetailDto.detail", target = "detail"),
                    @Mapping(source = "productDetailDto.productImageSmall", target = "productImageSmall"),
                    @Mapping(source = "promoItem.seckillPrice", target = "promoPrice"),
            }
    )
     PromoProductDetailDto convert2DetailDto(PromoItem promoItem, ProductDetailDto productDetailDto);
}